Browser
A web browser control that allows loading a web page or a local HTML file, accessing DOM and executing JavaScript on the loaded web page, getting notifications about loading progress, dispatching keyboard and mouse events, etc.
The Browser
instance itself is running in a separate native process that allocates memory and system resources that must be released. So, when a Browser
instance is no longer needed, it must be closed through the close method to release all the allocated memory and system resources. For example:
Browser browser = engine.newBrowser();
...
browser.close();
Any attempt to use an already closed Browser
instance will lead to the
IllegalStateException
.
The Browser
instance is closed automatically when its Engine is closed or unexpectedly crashed. If the instance represents a popup window created by JavaScript via the window.open()
function, then JavaScript can close the instance using the
window.close()
function.
To get notifications that the Browser
instance has been closed please subscribe to the following event:
browser.on(BrowserClosed.class, event -> {
// The Browser instance has been closed.
});
Functions
receiver
.receiver
.options
.PresentationRequest
specified on the page.Optional
that contains the focused Frame
on the currently loaded web page, otherwise an empty Optional
.Navigation
that allows controlling navigation in the current browser instance.
word
.BrowserSettings
that allows configuring the current browser instance.TextFinder
that allows finding text on a web page loaded in the current browser instance.